package com.luo.dao.impl;

import com.luo.dao.HotMappers;
import com.luo.dao.SlideShowMappers;
import com.luo.model.SlideShow;
import com.luo.model.SlideShowVO;
import com.luo.model.recommend;
import com.luo.util.SqlSessionUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;
import java.util.Map;

/**
 * 功能：
 * 作者：Luo。
 * 日期：2024/1/9 19:22
 */
public class SlideshowDaoImpl implements SlideShowMappers {

    @Override
    public List<SlideShow> queryTypeSlideShows(final String typeId) {
        SqlSession sqlSession = SqlSessionUtil.getSqlSession();
        SlideShowMappers mapper = sqlSession.getMapper(SlideShowMappers.class);
        List<SlideShow> slideShows = mapper.queryTypeSlideShows(typeId);
        sqlSession.close();
        return slideShows;
    }

    @Override
    public List<SlideShowVO> querySlideShow() {
        SqlSession sqlSession = SqlSessionUtil.getSqlSession();
        SlideShowMappers mapper = sqlSession.getMapper(SlideShowMappers.class);
        List<SlideShowVO> slideShows = mapper.querySlideShow();
        sqlSession.close();
        return slideShows;
    }

    @Override
    public int updateSlideShow(Map map) {
        SqlSession sqlSession = SqlSessionUtil.getSqlSession();
        SlideShowMappers mapper = sqlSession.getMapper(SlideShowMappers.class);
        int i = mapper.updateSlideShow(map);
        sqlSession.commit();
        sqlSession.close();
        return i;
    }
}
